import $http from '../../../servers/http';
import { Result } from '../../schema/Result';
/* 系统配置-号码属性管理
---------------------------------------------------------------- */
import { NumPropInfo } from '../../schema/NumProp';
/**新增号码属性 */
export const createNumProp = (data: NumPropInfo): Promise<any> => {
  return $http.post({
    url: '/icms/attributemanager/attributes',
    data,
  });
};

/**删除号码属性 */
export const deleteNumProp = (id: number): Promise<Result<null>> => {
  return $http.delete({
    url: `/icms/attributemanager/attributes/${id}`,
  });
};

/**编辑号码属性 */
export const modifyNumProp = (id: number, data: NumPropInfo): Promise<Result<null>> => {
  return $http.put({
    url: `/icms/attributemanager/attributes/${id}`,
    data,
  });
};

/**查询号码属性列表 */
export const getNumPropList = (data: {
  pageSize: number;
  pageNo: number;
  attributeName?: string;
}): Promise<Result<NumPropInfo[]>> => {
  return $http.get({
    url: '/icms/attributemanager/attributes',
    data,
  });
};

/**停用/启用号码属性 */
export const enableNumProp = (
  id: number,
  data: { attributeSwitch: string }
): Promise<Result<null>> => {
  return $http.patch({
    url: `/icms/attributemanager/attributes/${id}`,
    data,
  });
};

/**停用/启用敏感信息设置 */
export const enableSenstive = (
  id: number,
  data: { sensitiveSwitch: number }
): Promise<Result<null>> => {
  return $http.patch({
    url: `/icms/attributemanager/attributes/${id}/sensitive/${data.sensitiveSwitch}`,
  });
};
